/**  
 * @Title: HttpSenderTest.java
 * @Package com.icss.trans.send.httpput
 * @Description: TODO(用一句话描述该文件做什么)
 * @author ICSS
 * @date 2015-3-25 下午3:48:07
 * @version V1.0  
 */ 
package com.icss.trans.send.httpput;

import java.io.File;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.icss.trans.util.MD5Util;


/**
 * @ClassName: HttpSenderTest
 * @Description: 
 * @author ICSS
 * @date 2015-3-25 下午3:48:07
 *
 */
public class HttpSenderTest {

    /**
     * @Description:
     * @throws java.lang.Exception
     */
    @Before
    public void setUp() throws Exception {
    }

    /**
     * @Description: 
     * @throws java.lang.Exception
     */
    @After
    public void tearDown() throws Exception {
    }

    /**
     * Test method for {@link com.icss.trans.send.httpput.HttpSender#sendData(com.icss.trans.send.httpput.SendParam)}.
     */
    @Test
    public void testSendData() {
        try {
            SendParam param = new SendParam();
            param.setSourceAppCode("ICSS_ETL");
            param.setDestAppCode("ICSS_ETL");
            param.setDestOrgCode("10000001");
            param.setDataTransType("test001");
            param.setFileName("cs2gjj201505041639.xml");
            param.setFileInputstream(new File("E:/test/1.xml"));
            param.setMd5Str(MD5Util.getFileMD5String(param.getFileInputstream()));
            param.setKey("key001");
            param.setTransType("2");
            param.setAppTransId("11111");
            // param.setDesc("");

            int code = HttpSender.sendData(param);
            System.out.println(code);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Test
    public void testSendDataBuilder() {
        try {
            SendParam param = new SendParam.Builder().sourceAppCode("ICSS_ETL")
                    .destAppCode("ICSS_ETL")
                    .dataTransType("test001")
                    .destOrgCode("10000001")
                    .fileName("cs2gjj201505041604_cd.csv")
                    .fileInputstream(new File("E:\\test\\etl.csv"))
                    .md5Str(MD5Util.getFileMD5String(new File("E:\\test\\etl.csv")))
                    .key("key001")
                    .transType("1")
                    .appTransId("1111")
                    .build();

            int code = HttpSender.sendData(param);
            System.out.println(code);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
